//
//  JWSearcell.m
//  test
//
//  Created by 李彦宏 on 2018/1/30.
//  Copyright © 2018年 朱圳. All rights reserved.
//

#import "JWSearcell.h"

@implementation JWSearcell


//类方法快速创建cell
+(instancetype)cellwithTableview:(UITableView *)tableview{
    
    // 1.创建cell
    static NSString *ID = @"cell";
    JWSearcell *cell = [tableview dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[JWSearcell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return  cell;
    
}
/**
 *  cell的初始化方法，一个cell只会调用一次
 *  一般在这里添加所有可能显示的子控件，以及子控件的一次性设置
 */
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //添加UI控件
        [self setUI];
    }
    return self;
}
-(void)setUI{
    
    UILabel *lb1=[[UILabel alloc]init];
    lb1.textColor=[UIColor blackColor];
    lb1.textAlignment=NSTextAlignmentLeft;
    lb1.font=[UIFont systemFontOfSize:14];
    self.nameLab=lb1;
    [self.contentView addSubview:lb1];
    
    UILabel *lb2=[[UILabel alloc]init];
    lb2.textColor=[UIColor blackColor];
    lb2.textAlignment=NSTextAlignmentLeft;
    lb2.font=[UIFont systemFontOfSize:14];
    lb2.numberOfLines=0;
    self.specialLab=lb2;
    [self.contentView addSubview:lb2];
//    //下划线
//    UILabel *lb3=[[UILabel alloc]init];
//    lb3.backgroundColor=[UIColor grayColor];
//    [self.contentView addSubview:lb3];
    
    UILabel *lb4=[[UILabel alloc]init];
    lb4.textColor=[UIColor blackColor];
    lb4.textAlignment=NSTextAlignmentCenter;
    lb4.text=@"姓名：";
    lb4.font=[UIFont systemFontOfSize:14];
    [self.contentView addSubview:lb4];
    
    UILabel *lb5=[[UILabel alloc]init];
    lb5.textColor=[UIColor blackColor];
    lb5.textAlignment=NSTextAlignmentLeft;
    lb5.text=@"专业：";
    lb5.font=[UIFont systemFontOfSize:14];
    [self.contentView addSubview:lb5];
    
    UILabel *lb6=[[UILabel alloc]init];
    lb6.textColor=[UIColor lightGrayColor];
    lb6.textAlignment=NSTextAlignmentLeft;
    lb6.text=@">";
    lb6.font=[UIFont systemFontOfSize:17];
    [self.contentView addSubview:lb6];
    
    
    //设置位置
    [lb4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(10);
        make.centerY.equalTo(lb1);
        make.width.mas_equalTo(45);
        
    }];
    [lb1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(lb4.mas_right).offset(10);
        make.top.equalTo(self.contentView.mas_top).offset(5);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(5);
            make.size.width.mas_equalTo(80);

    }];
    [lb5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(lb1.mas_right).offset(5);
        make.centerY.equalTo(lb1);
        make.width.mas_equalTo(45);
    }];
    [lb2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).offset(0);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(0);
        make.left.equalTo(lb5.mas_right).offset(5);
        make.right.equalTo(lb6.mas_left).offset(-5);
    }];
//    [lb3 mas_makeConstraints:^(MASConstraintMaker *make) {
//    make.size.mas_equalTo(CGSizeMake(self.contentView.width, 0.5));
//        make.bottom.equalTo(self.contentView.mas_bottom).offset(0);
//    }];
    [lb6 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(lb1);
        make.right.equalTo(self.contentView.mas_right).offset(-5);
        make.width.mas_equalTo(8);
    }];
    
}





- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
